﻿using System;
using System.Windows.Forms;

namespace WindowsAPI.Controls
{
    public class DragAndResizeController
    {
        /* -------------------------------------------------------------------------------- */

        public enum State
        {
            Drag = 1,
            Resize = 2,
            Disable = 0
        }

        [Flags]
        public enum BorderType
        {
            Left = 1,
            Top = 2,
            Right = 4,
            Botom = 8
        }

        /* -------------------------------------------------------------------------------- */

        private Control f_Control;

        private State f_Mode;

        private bool f_MouseEntred;

        //private int f_BorderWidth = 5;



        /* -------------------------------------------------------------------------------- */

        public State Mode
        {
            get { return f_Mode; }
            set
            {
                if(Equals(f_Mode, value)) return;
                f_Mode = value;

            }
        }

        /* -------------------------------------------------------------------------------- */

        public DragAndResizeController(Control control)
        {
            if(control == null)
                throw new ArgumentNullException(nameof(control), "control == null");

            f_Control = control;

            f_Control.MouseEnter += OnMouseEnter;
            f_Control.MouseLeave += OnMouseLeave;

            f_Control.MouseMove += OnMouseMove;
        }

        /* -------------------------------------------------------------------------------- */

        private void OnMouseMove(object Sender, System.Windows.Forms.MouseEventArgs E)
        {
            if(!f_MouseEntred) return;
        }

        private void OnMouseEnter(object Sender, EventArgs E)
        {
            f_MouseEntred = true;
        }

        private void OnMouseLeave(object Sender, EventArgs E)
        {
            f_MouseEntred = false;
        }

        /* -------------------------------------------------------------------------------- */
    }
}
